<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/9/2
  Time: 下午2:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>转账</title>
    <script src="https://code.jquery.com/jquery-3.7.1.min.js"
            integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
</head>
<body>
<form action="<%=request.getContextPath()%>/tj" id="aa">
    <table border="1">
        <thead>
        <tr>
            <th>付款人姓名</th>
            <td><input type="text" name="Fname" placeholder="请输入付款人姓名"></td>
        </tr>
        <tr>
            <th>收款人姓名</th>
            <td>
                <select id="SN" name="sneme">
                    <option value="0">--请选择--</option>
                </select>
            </td>
        </tr>
        <tr>
            <th>收款人银行卡号</th>
            <td><input type="text" name="bcm" placeholder="请输入收款人银行卡号"></td>
        </tr>
        <tr>
            <th>转账金额</th>
            <td><input id="baivs" type="text" name="baivs" placeholder="请输入转账金额"></td>
        </tr>
        </thead>
    </table>
    <button type="submit" id="myButton">提加</button>
    <button type="reset">重置</button>
</form>
<script>
    $(function () {
        $.getJSON("<%=request.getContextPath()%>/cx", $("#aa").serialize(), shoeew)
    })

    function shoeew(da) {
        $(da).each(function (index, v) {
            if (v.id == location.search.substr(4)) {
                $("input[name='Fname']").val(v.name)
            }
            if (v.id != location.search.substr(4)) {
                $("#SN").append("<option value=" + this.id + ">" + v.name + "</option>")
            }
        })
        $("#SN").change(function () {
            // 当选择改变时，获取选中的值
            var selectedValue = $("#SN").val();
            $.getJSON("<%=request.getContextPath()%>/cx", "id=" + selectedValue, function (sa) {
                $(sa).each(function (ind, a) {
                    if (a.id == selectedValue) {
                        $("input[name='bcm']").val(a.bcm);
                    }
                })
            })
        });
    }
</script>
</body>
</html>
